package com.zsix.api.controller;

import com.alibaba.fastjson.JSONObject;
import com.zsix.common.common.page.BaseController;
import com.zsix.common.common.page.PageDataTable;
import com.zsix.common.dto.controllerParams.GroupUsersParams;
import com.zsix.common.dto.controllerParams.UserParams;
import com.zsix.common.dto.orgDto.SysRoleDto;
import com.zsix.common.entity.formComponents.FormSortEntity;
import com.zsix.common.entity.orgmanagement.*;
import com.zsix.common.util.ResultRes;
import com.zsix.common.util.StringUtils;
import com.zsix.framework.aspectj.annotation.OperLog;
import com.zsix.framework.aspectj.operate.LogConst;
import com.zsix.system.service.IOrgManagementService;
import java.util.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

@RestController
@RequestMapping("/orgm")
public class orgManagementController extends BaseController {
    @Autowired
    private IOrgManagementService orgManagementService;

    /***
     * 获取公司列表
     * @return
     */
    @OperLog(operModul = "组织结构-公司" , operType = LogConst.OTHER , operDesc = "获取公司列表")
    @GetMapping("/getCompanyList")
    public ResultRes getCompanyList(){
        try {
            return ResultRes.success(orgManagementService.getCompanyList());
        }
        catch (Exception ex){
            return ResultRes.error(ex.getMessage());
        }
    }

    /**
     * 增加公司
     * @param companyEntity
     * @return
     */
    @OperLog(operModul = "组织结构-公司" , operType = LogConst.INSERT , operDesc = "增加公司")
    @PostMapping(value = "/addCompany")
    public ResultRes addCompany(@RequestBody CompanyEntity companyEntity){
        try {
            return ResultRes.success(orgManagementService.addCompany(companyEntity));
        }
        catch (Exception ex){
            return ResultRes.error(ex.getMessage());
        }
    }

    /**
     * 修改公司信息
     * @param companyEntity
     * @return
     */
    @OperLog(operModul = "组织结构-公司" , operType = LogConst.UPDATE , operDesc = "修改公司信息")
    @PostMapping(value = "/updateCompany")
    public ResultRes updateCompany(@RequestBody CompanyEntity companyEntity){
        try{
            return ResultRes.success(orgManagementService.updateCompany(companyEntity));
        }
        catch (Exception ex){
            return ResultRes.error(ex.getMessage());
        }
    }

    /**
     * 删除公司信息
     * @param companyEntity
     * @return
     */
    @OperLog(operModul = "组织结构-公司" , operType = LogConst.DELETE , operDesc = "删除公司")
    @PostMapping(value = "/deleteCompany")
    public ResultRes deleteCompany(@RequestBody CompanyEntity companyEntity){
        try {
            return ResultRes.success(orgManagementService.deleteCompany(companyEntity));
        }
        catch (Exception ex){
            return ResultRes.error(ex.getMessage());
        }
    }

    /**
     * 获取部门列表
     * @return
     */
    @OperLog(operModul = "组织结构-部门" , operType = LogConst.OTHER , operDesc = "获取部门列表")
    @PostMapping("/getDepartmentList")
    public PageDataTable getDepartmentList(@RequestBody DepartmentEntity departmentEntity){
        startPage();
        List<DepartmentEntity> list=orgManagementService.getDepartmentList(departmentEntity);
        return getDataTable(list);
    }

    /**
     * 获取部门树
     * @return
     */
    @OperLog(operModul = "组织结构-部门" , operType = LogConst.OTHER , operDesc = "获取部门树")
    @GetMapping("/getDepartmentEntityList")
    public ResultRes getDepartmentEntityList(){
        return ResultRes.success(orgManagementService.getDepartmentEntityList());
    }

    /**
     * 获取部门人员
     * @return
     */
    @OperLog(operModul = "组织结构-部门" , operType = LogConst.OTHER , operDesc = "获取部门下属人员")
    @PostMapping("/getDeptUsers")
    public PageDataTable getDeptUsers(@RequestBody DepartmentEntity departmentEntity){
        startPage();
        List<UserEntity> list=orgManagementService.getDeptUsers(departmentEntity);
        return getDataTable(list);
    }

    /**
     * 获取人员树
     * @return
     */
    @OperLog(operModul = "组织结构-部门" , operType = LogConst.OTHER , operDesc = "获取部门人员树型数据")
    @GetMapping("/getDeptUserTree")
    public ResultRes getDeptUserTree(){
        try {
            return ResultRes.success(orgManagementService.getDeptUserTree());
        }
        catch (Exception ex){
            return ResultRes.error(ex.getMessage());
        }
    }

    /**
     * 获取公司下的部门
     * @param companyId
     * @return
     */
    @OperLog(operModul = "组织结构-公司" , operType = LogConst.OTHER , operDesc = "获取公司下的部门列表")
    @GetMapping("/getDeptByCompany")
    public ResultRes getDeptByCompany(@RequestParam("companyId") Integer companyId){
        try {
            return ResultRes.success(orgManagementService.getDeptByCompany(companyId));
        }
        catch (Exception ex){
            return ResultRes.error(ex.getMessage());
        }
    }
    /**
     * 增加部门
     * @param departmentEntity
     * @return
     */
    @OperLog(operModul = "组织结构-部门" , operType = LogConst.INSERT , operDesc = "增加部门")
    @PostMapping(value = "/addDepartment")
    public ResultRes addDepartment(@RequestBody DepartmentEntity departmentEntity){
        try {
            return ResultRes.success(orgManagementService.addDepartment(departmentEntity));
        }
        catch (Exception ex){
            return ResultRes.error(ex.getMessage());
        }
    }

    /**
     * 修改部门
     * @param departmentEntity
     * @return
     */
    @OperLog(operModul = "组织结构-部门" , operType = LogConst.UPDATE , operDesc = "修改部门信息")
    @PostMapping(value = "/updateDepartment")
    public ResultRes updateDepartment(@RequestBody DepartmentEntity departmentEntity){
        try {
            return ResultRes.success(orgManagementService.updateDepartment(departmentEntity));
        }
        catch (Exception ex){
            return ResultRes.error(ex.getMessage());
        }
    }

    /**
     * 删除部门
     * @param departmentEntity
     * @return
     */
    @OperLog(operModul = "组织结构-部门" , operType = LogConst.DELETE , operDesc = "删除部门信息")
    @PostMapping(value = "/deleteDepartment")
    public ResultRes deleteDepartment(@RequestBody DepartmentEntity departmentEntity){
        try {
            return ResultRes.success(orgManagementService.deleteDepartment(departmentEntity));
        }
        catch (Exception ex){
            return ResultRes.error(ex.getMessage());
        }
    }

    /**
     * 设置部门负责人
     * @param departmentEntity
     * @return
     */
    @OperLog(operModul = "组织结构-部门" , operType = LogConst.UPDATE , operDesc = "设置部门负责人")
    @PostMapping(value = "/setDepartmentManager")
    public ResultRes setDepartmentManager(@RequestBody DepartmentEntity departmentEntity){
        try {
            return ResultRes.success(orgManagementService.setDepartmentManager(departmentEntity));
        }
        catch (Exception ex){
            return ResultRes.error(ex.getMessage());
        }
    }

    /**
     * 设置部门分管领导
     * @param departmentEntity
     * @return
     */
    @OperLog(operModul = "组织结构-部门" , operType = LogConst.UPDATE , operDesc = "设置部门分管领导")
    @PostMapping(value = "/setDepartmentLeader")
    public ResultRes setDepartmentLeader(@RequestBody DepartmentEntity departmentEntity){
        try {
            return ResultRes.success(orgManagementService.setDepartmentLeader(departmentEntity));
        }
        catch (Exception ex){
            return ResultRes.error(ex.getMessage());
        }
    }

    /**
     * 设置所属公司
     * @param departmentEntity
     * @return
     */
    @OperLog(operModul = "组织结构-部门" , operType = LogConst.UPDATE , operDesc = "设置部门所属公司")
    @PostMapping(value = "/updateDeptCompany")
    public ResultRes updateDeptCompany(@RequestBody DepartmentEntity departmentEntity){
        try {
            return ResultRes.success(orgManagementService.updateDeptCompany(departmentEntity));
        }
        catch (Exception ex){
            return ResultRes.error(ex.getMessage());
        }
    }

    /**
     * 获取组织结构数据
     * @return
     */
    @OperLog(operModul = "组织结构" , operType = LogConst.OTHER , operDesc = "获取整个组织结构的数据")
    @GetMapping("/getOrgData")
    public ResultRes getOrgData(){
        return ResultRes.success(orgManagementService.getOrgData());
    }

    /**
     * 获取岗位列表--分页
     * @return
     */
    @OperLog(operModul = "组织结构-岗位" , operType = LogConst.OTHER , operDesc = "获取岗位列表分页数据")
    @PostMapping("/positionListPage")
    public PageDataTable positionListPage(@RequestBody PositionEntity positionEntity){
        startPage();
        List<PositionEntity> list=orgManagementService.positionListPage(positionEntity);
        return getDataTable(list);
    }

    /**
     * 获取用户的岗位
     * @param username
     * @return
     */
    @OperLog(operModul = "组织结构-岗位" , operType = LogConst.OTHER , operDesc = "获取人员拥有的岗位列表")
    @GetMapping("/positionListByUser")
    public ResultRes positionListByUser(@RequestParam("username") String username){
        try {
            return ResultRes.success(orgManagementService.positionListByUser(username));
        }
        catch (Exception ex){
            return ResultRes.error(ex.toString());
        }
    }

    /**
     * 获取岗位成员
     * @param positionEntity
     * @return
     */
    @OperLog(operModul = "组织结构-岗位" , operType = LogConst.OTHER , operDesc = "获取岗位成员")
    @GetMapping("/getPositionUser")
    public PageDataTable getPositionUser(PositionEntity positionEntity)
    {
        startPage();
        List<UserEntity> list=orgManagementService.getPositionUser(positionEntity);
        return getDataTable(list);
    }

    /**
     * 增加岗位
     * @param positionEntity
     * @return
     */
    @OperLog(operModul = "组织结构-岗位" , operType = LogConst.INSERT , operDesc = "增加岗位")
    @PostMapping("/addPosition")
    public ResultRes addPosition(@RequestBody PositionEntity positionEntity){
        try {
            return ResultRes.success(orgManagementService.addPosition(positionEntity));
        }
        catch (Exception ex){
            return ResultRes.error(ex.toString());
        }
    }

    /**
     * 修改岗位信息
     * @param positionEntity
     * @return
     */
    @OperLog(operModul = "组织结构-岗位" , operType = LogConst.UPDATE , operDesc = "修改岗位信息")
    @PostMapping("/updatePosition")
    public ResultRes updatePosition(@RequestBody PositionEntity positionEntity){
        try {
            return ResultRes.success(orgManagementService.updatePosition(positionEntity));
        }
        catch (Exception ex){
            return ResultRes.error(ex.toString());
        }
    }

    /**
     * 删除岗位
     * @param positionEntity
     * @return
     */
    @OperLog(operModul = "组织结构-岗位" , operType = LogConst.DELETE , operDesc = "删除岗位信息")
    @PostMapping("/deletePosition")
    public ResultRes deletePosition(@RequestBody PositionEntity positionEntity){
        try {
            return ResultRes.success(orgManagementService.deletePosition(positionEntity));
        }
        catch (Exception ex){
            return ResultRes.error(ex.toString());
        }
    }

    /**
     * 删除用户岗位
     * @param username
     * @return
     */
    @OperLog(operModul = "组织结构-岗位" , operType = LogConst.DELETE , operDesc = "删除用户岗位")
    @GetMapping("/deletePositionByUser")
    public ResultRes deletePositionByUser(@RequestParam("username") String username){
        try {
            return ResultRes.success(orgManagementService.deletePositionUser(username));
        }
        catch (Exception ex){
            return ResultRes.error(ex.toString());
        }
    }
    /**
     * 获取角色列表
     * @return
     */
    @OperLog(operModul = "组织结构-角色" , operType = LogConst.OTHER , operDesc = "获取角色列表")
    @GetMapping("/rolesList")
    public ResultRes rolesList(){
        try {
            return ResultRes.success(orgManagementService.rolesList());
        }
        catch (Exception ex){
            return ResultRes.error(ex.toString());
        }
    }
    /**
     * 获取角色部门
     * @return
     */
    @OperLog(operModul = "组织结构-角色" , operType = LogConst.OTHER , operDesc = "获取角色部门")
    @GetMapping("/roleDeptTreeselect")
    public ResultRes roleDeptTreeselect(@RequestParam("id") String id){
        try {
            return ResultRes.success(orgManagementService.roleDeptTreeselect(id));
        }
        catch (Exception ex){
            return ResultRes.error(ex.toString());
        }
    }

    /**
     * 获取角色列表--分页
     * @return
     */
    @OperLog(operModul = "组织结构-角色" , operType = LogConst.OTHER , operDesc = "获取角色列表分页")
    @PostMapping("/rolesListPage")
    public PageDataTable rolesListPage(@RequestBody RolesEntity roles){
        startPage();
        List<RolesEntity> list=orgManagementService.rolesListPage(roles);
        return getDataTable(list);
    }

    /**
     * 获取用户的角色
     * @param username
     * @return
     */
    @OperLog(operModul = "组织结构-角色" , operType = LogConst.OTHER , operDesc = "获取用户角色列表")
    @GetMapping("/rolesListByUser")
    public ResultRes rolesListByUser(@RequestParam("username") String username){
        try {
            return ResultRes.success(orgManagementService.rolesListByUser(username));
        }
        catch (Exception ex){
            return ResultRes.error(ex.toString());
        }
    }
    /**
     * 获取角色成员
     * @param roles
     * @return
     */
    @OperLog(operModul = "组织结构-角色" , operType = LogConst.OTHER , operDesc = "获取角色成员列表")
    @GetMapping("/getRoleUsers")
    public PageDataTable getRoleUsers(RolesEntity roles)
    {
        startPage();
        List<UserEntity> list=orgManagementService.getRoleUsers(roles);
        return getDataTable(list);
    }
    /**
     * 增加角色
     * @param sysRoleDto
     * @return
     */
    @OperLog(operModul = "组织结构-角色" , operType = LogConst.INSERT , operDesc = "增加角色")
    @PostMapping("/addRoles")
    public ResultRes addRoles(@RequestBody SysRoleDto sysRoleDto){
        try {
            return ResultRes.success(orgManagementService.addRoles(sysRoleDto));
        }
        catch (Exception ex){
            return ResultRes.error(ex.toString());
        }
    }

    /**
     * 修改角色信息
     * @param sysRoleDto
     * @return
     */
    @OperLog(operModul = "组织结构-角色" , operType = LogConst.UPDATE , operDesc = "修改角色信息")
    @PostMapping("/updateRoles")
    public ResultRes updateRoles(@RequestBody SysRoleDto sysRoleDto){
        try {
            return ResultRes.success(orgManagementService.updateRoles(sysRoleDto));
        }
        catch (Exception ex){
            return ResultRes.error(ex.toString());
        }
    }

    /**
     * 删除角色
     * @param sysRoleDto
     * @return
     */
    @OperLog(operModul = "组织结构-角色" , operType = LogConst.DELETE , operDesc = "删除角色")
    @PostMapping("/deleteRoles")
    public ResultRes deleteRoles(@RequestBody SysRoleDto sysRoleDto){
        try {
            return ResultRes.success(orgManagementService.deleteRoles(sysRoleDto));
        }
        catch (Exception ex){
            return ResultRes.error(ex.toString());
        }
    }

    /**
     * 删除用户角色
     * @param username
     * @return
     */
    @OperLog(operModul = "组织结构-角色" , operType = LogConst.DELETE , operDesc = "删除用户角色")
    @GetMapping("/deleteRoleByUser")
    public ResultRes deleteRoleByUser(@RequestParam("username") String username){
        try {
            return ResultRes.success(orgManagementService.deleteRoleUser(username));
        }
        catch (Exception ex){
            return ResultRes.error(ex.toString());
        }
    }

    /**
     * 获取人员列表--分页
     * @return
     */
    @OperLog(operModul = "组织结构-人员" , operType = LogConst.OTHER , operDesc = "获取人员列表分页数据")
    @PostMapping("/getUserList")
    public PageDataTable getUserList(@RequestBody UserEntity user){
        startPage();
        List<UserEntity> list=orgManagementService.getUserList(user);
        return getDataTable(list);
    }
    @OperLog(operModul = "组织结构-人员" , operType = LogConst.OTHER , operDesc = "获取人员信息")
    @GetMapping("/getUserEntity")
    public ResultRes getUserEntity(@RequestParam("username") String username){
        try{
            return ResultRes.success(orgManagementService.getUserEntity(username));
        }
        catch (Exception ex){
            return ResultRes.error(ex.toString());
        }
    }
    @OperLog(operModul = "组织结构-人员" , operType = LogConst.OTHER , operDesc = "根据部门编号获取人员列表")
    @GetMapping("/getUserByDepartId")
    public ResultRes getUserByDepartId(@RequestParam("departid") String departid){
        try{
            return ResultRes.success(orgManagementService.getUserByDepartId(departid));
        }
        catch (Exception ex){
            return ResultRes.error(ex.toString());
        }
    }

    /**
     * 增加人员
     * @param param
     * @return
     */
    @OperLog(operModul = "组织结构-人员" , operType = LogConst.INSERT , operDesc = "增加人员")
    @PostMapping(value = "/addUser")
    public ResultRes addUser(@RequestBody UserParams param){
        try{
            return ResultRes.success(orgManagementService.addUser(param));
        }
        catch (Exception ex){
            return ResultRes.error(ex.toString());
        }
    }

    /**
     * 修改人员信息
     * @param param
     * @return
     */
    @OperLog(operModul = "组织结构-人员" , operType = LogConst.UPDATE , operDesc = "修改人员信息")
    @PostMapping(value = "/updateUser")
    public ResultRes updateUser(@RequestBody UserParams param){
        try{
            return ResultRes.success(orgManagementService.updateUser(param));
        }
        catch (Exception ex){
            return ResultRes.error(ex.toString());
        }
    }

    /**
     * 修改密码
     * @param param
     * @return
     */
    @OperLog(operModul = "组织结构-人员" , operType = LogConst.UPDATE , operDesc = "修改登录密码")
    @PostMapping(value = "/updatePwd")
    public ResultRes updatePwd(@RequestBody UserParams param){
        try{
            return ResultRes.success(orgManagementService.updatePwd(param));
        }
        catch (Exception ex){
            return ResultRes.error(ex.toString());
        }
    }

    /**
     * 重置密码
     * @param param
     * @return
     */
    @OperLog(operModul = "组织结构-人员" , operType = LogConst.UPDATE , operDesc = "重置密码")
    @PostMapping(value = "/resetPwd")
    public ResultRes resetPwd(@RequestBody UserParams param){
        try{
            return ResultRes.success(orgManagementService.resetPwd(param));
        }
        catch (Exception ex){
            return ResultRes.error(ex.toString());
        }
    }

    /**
     * 删除用户
     * @param userEntity
     * @return
     */
    @OperLog(operModul = "组织结构-人员" , operType = LogConst.DELETE , operDesc = "删除人员")
    @PostMapping(value = "/deleteUser")
    public ResultRes deleteUser(@RequestBody UserEntity userEntity){
        try{
            return ResultRes.success(orgManagementService.deleteUser(userEntity));
        }
        catch (Exception ex){
            return ResultRes.error(ex.toString());
        }
    }
    /**
     * 获取用户分组
     * @param groupEntity
     * @return
     */
    @OperLog(operModul = "组织结构-用户组" , operType = LogConst.OTHER , operDesc = "获取用户组列表分页数据")
    @PostMapping(value = "/getGroupPage")
    public PageDataTable getGroupPage(@RequestBody GroupEntity groupEntity){
        startPage();
        List<GroupEntity> list=orgManagementService.getGroupPage(groupEntity);
        return getDataTable(list);
    }

    /**
     * 获取分组内的成员
     * @param groupEntity
     * @return
     */
    @OperLog(operModul = "组织结构-用户组" , operType = LogConst.OTHER , operDesc = "获取用户组中的人员")
    @PostMapping(value = "/getUserByGorupId")
    public PageDataTable getUserByGorupId(@RequestBody GroupEntity groupEntity){
        startPage();
        List<UserEntity> list=orgManagementService.getUserByGorupId(groupEntity);
        return getDataTable(list);
    }
    /**
     * 增加分组
     * @param groupEntity
     * @return
     */
    @OperLog(operModul = "组织结构-用户组" , operType = LogConst.OTHER , operDesc = "增加用户组")
    @PostMapping(value = "/addGroup")
    public ResultRes addGroup(@RequestBody GroupEntity groupEntity){
        try{
            return ResultRes.success(orgManagementService.addGroup(groupEntity));
        }
        catch (Exception ex){
            return ResultRes.error(ex.toString());
        }
    }

    /**
     * 更新分组
     * @param groupEntity
     * @return
     */
    @OperLog(operModul = "组织结构-用户组" , operType = LogConst.OTHER , operDesc = "修改用户组")
    @PostMapping(value = "/updataGroup")
    public ResultRes updataGroup(@RequestBody GroupEntity groupEntity){
        try{
            return ResultRes.success(orgManagementService.updataGroup(groupEntity));
        }
        catch (Exception ex){
            return ResultRes.error(ex.toString());
        }
    }

    /**
     * 删除分组
     * @param groupEntity
     * @return
     */
    @OperLog(operModul = "组织结构-用户组" , operType = LogConst.OTHER , operDesc = "删除用户组")
    @PostMapping(value = "/deleteGroup")
    public ResultRes deleteGroup(@RequestBody GroupEntity groupEntity){
        try{
            return ResultRes.success(orgManagementService.deleteGroup(groupEntity));
        }
        catch (Exception ex){
            return ResultRes.error(ex.toString());
        }
    }

    /**
     * 增加分组人员
     * @param param
     * @return
     */
    @OperLog(operModul = "组织结构-用户组" , operType = LogConst.OTHER , operDesc = "增加用户组成员")
    @PostMapping(value = "/addUserGroup")
    public ResultRes addUserGroup(@RequestBody GroupUsersParams param){
        try{
            return ResultRes.success(orgManagementService.addUserGroup(param));
        }
        catch (Exception ex){
            return ResultRes.error(ex.toString());
        }
    }

    /**
     * 删除分组人员
     * @param param
     * @return
     */
    @OperLog(operModul = "组织结构-用户组" , operType = LogConst.OTHER , operDesc = "删除用户组")
    @PostMapping(value = "/deleteUserGroup")
    public ResultRes deleteUserGroup(@RequestBody GroupUsersParams param){
        try{
            return ResultRes.success(orgManagementService.deleteUserGroup(param));
        }
        catch (Exception ex){
            return ResultRes.error(ex.toString());
        }
    }

    @OperLog(operModul = "组操作" , operType = LogConst.OTHER , operDesc = "获取组分类列表")
    @GetMapping("/getAllOrgGroupTypeList")
    public ResultRes getAllOrgGroupTypeList(){
        return ResultRes.success(orgManagementService.getAllOrgGroupTypeList());
    }

    @OperLog(operModul = "组操作" , operType = LogConst.OTHER , operDesc = "查看某个组分类信息")
    @GetMapping("/getOrgGroupTypeById")
    public ResultRes getOrgGroupTypeById(HttpServletResponse response,
        @RequestParam("id") String id){
        OrgGroupTypeEntity  orgGroupTypeEntity=orgManagementService.getOrgGroupTypeById(id);
        if(orgGroupTypeEntity!=null) {
            return ResultRes.success(orgGroupTypeEntity);
        }
        else{
            return ResultRes.error("不存在id为["+id+"]的对象。");
        }
    }

    @OperLog(operModul = "组分类操作" , operType = LogConst.INSERT , operDesc = "增加组分类")
    @PostMapping("/addOrgGroupType")
    public ResultRes addOrgGroupType(@RequestBody JSONObject param){
        String id= UUID.randomUUID().toString();
        String name=param.getString("name");
        String parentNo=param.getString("parentId");
        String msg=orgManagementService.addOrgGroupType(id,name,parentNo);
        if(msg.equals("执行成功")) {
            return ResultRes.success(msg);
        }
        else{
            return ResultRes.error(msg);
        }
    }
    @OperLog(operModul = "组分类操作" , operType = LogConst.DELETE , operDesc = "删除组分类")
    @PostMapping("/deleteOrgGroupTypeById")
    public ResultRes deleteOrgGroupTypeById(@RequestBody JSONObject param){
        String id=param.getString("orgGroupTypeID");
        String msg=orgManagementService.deleteOrgGroupTypeById(id);
        if(msg.equals("执行成功")) {
            return ResultRes.success(msg);
        }
        else{
            return ResultRes.error(msg);
        }
    }
    @OperLog(operModul = "组分类操作" , operType = LogConst.UPDATE , operDesc = "更新组分类")
    @PostMapping("/updateOrgGroupType")
    public ResultRes updateOrgGroupType(@RequestBody JSONObject param){
        String id=param.getString("orgGroupTypeID");
        String name=param.getString("name");
        String parentNo=param.getString("parentId");
        String msg=orgManagementService.updateOrgGroupType(id,name,parentNo);
        if(msg.equals("执行成功")) {
            return ResultRes.success(msg);
        }
        else{
            return ResultRes.error(msg);
        }
    }

}
